(() => {
  class Animal {
    name: string
    age: number
    constructor(name: string, age: number) {
      this.name = name
      this.age = age
    }

    say() {
      console.log("我是动物");
    }
  }

  // extends 继承父类中的方法
  class Dog extends Animal {
    //与父类中方法同名时,可重写此方法
    say(): void {
      console.log("汪汪汪");
    }
  }

  class Cat extends Animal {
    say(): void {
      console.log('喵喵喵');
    }
  }
})()